home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-01 | 7.7 KB | 185 lines | [TEXT/KAHL] |
- Description of Tracker protocol:
-
-
- The Interface program controls the Servers through the use of
- Apple Events. The following document describes how to use the
- controls so that either the Server of the Interface may be replaced.
-
- In my terminology,
- Interface: The program used to select the songs to play.
- Server: The small program that actually plays the song.
-
- Note that #define's for many of the values here can be found in
- the file "mac_events.h" which you can simply lift out and put into
- your own files.
-
-
-
- Starting the Server:
-
- The server is launched with an extended Open Document Apple Event.
- The event should contain one (1) file specification describing which
- song to open, in the normal Open Document way. When launched, the
- server should continually call WaitNextEvent, waiting for the Open
- Event. It should also be aware that a Quit Event might come at
- this point.
-
- In addition to the required parameter, there are several
- additional parameters which describe the options to be used to
- play back the song:
-
- Key Word Code Type
- -----------------------------------------------------------------------------------
- keyAntiAliasing '∫Saa' typeShortInteger
- Boolean flag: 1 = use antialiasing algorithm, 0 = use fast algorithm
-
- keyStereoOn '∫Sso' typeShortInteger
- Boolean flag: 1 = use stereo playback, 0 = use mono playback
-
- keySamplingRate '∫Ssr' typeShortInteger
- Integer part of sampling rate in Hertz. Should be converted to an unsigned
- 16-bit integer upon receipt, and then treated however your program needs to.
- (Usually shifted left by 16 to create a Fixed type for the Sound Manager.)
-
- keyNumRepeats '∫Snr' typeShortInteger
- The number of times to repeat the song. 0 = repeat indefinitely, 1 = repeat once.
- 2 and up means repeat that many times.
-
- keySpeed '∫Ssp' typeShortInteger
- The speed in the number of ProTracker frames per second. Usually, this is 50.
-
- keyStereoMix '∫Ssm' typeShortInteger
- How to mix for stereo. 0 is no mixing (hard separation), 100 is full mixing (mono).
- Any number in between can be sent, but do not send negative numbers or numbers
- that exceed 100.
-
- keyLoudness '∫Svl' typeShortInteger
- Value indicating loudness to play song at. Generally, 0 is silence, and 64 is
- the maximum value. You may go as high as 255, so the tracker should constrain
- the volume at 64 if it can't handle values greater than 64. Negative values or
- values greater than 255 should never be passed.
-
- keyNumBits '∫Bit' typeShortInteger
- Number of bits per signal level value to use. This should either be 8 or 16.
-
- keySenderPSN '∫Psn' typeProcessSerialNumber
- Process serial number of the launching process. This is used to send error
- messages back to the launching process.
-
- If these parameters are missing, the tracker should supply reasonable
- defaults. This might happen if the user drags a song onto the tracker
- from the Finder.
-
-
-
- Control Event: Changing settings "on the fly."
-
- The control event is a custom event. The Event Class is '∫Tsp' and the
- Event Type is '∫Ctl'. This event may contain any of the following parameters
- to be acted upon as soon as possible.
-
- Key Word Code Type
- -----------------------------------------------------------------------------------
- keyAntiAliasing '∫Saa' typeShortInteger
- keyStereoOn '∫Sso' typeShortInteger
- keySamplingRate '∫Ssr' typeShortInteger
- keyNumRepeats '∫Snr' typeShortInteger
- keySpeed '∫Ssp' typeShortInteger
- keyStereoMix '∫Ssm' typeShortInteger
- keyLoudness '∫Svl' typeShortInteger
-
- keyKeyPressCharacter '∫Key' typeShortInteger
-
- All of the parameters which can also occur in the Open Document event have
- the same meaning here as they do in the Open Document event.
-
- The KeyPress event originally faked keypresses to Espie's Tracker running it's
- unaltered UNIX interface behind the scenes. That's how it got its name.
- However, it has changed to support general interactive control.
-
- Usually, the parameter is interpreted as a character. The following
- characters are currently supported:
-
- Character Description
- --------------------------------------------------------------
- '>' Fast Forward Begin
- This indicates that the tracker should begin fast forwarding. It is
- sent when the user presses the mouse button DOWN in the fast forward
- control. The program should continue to fast forward the song until
- notified otherwise.
-
- '<' Rewind Begin
- Rewind was originally intended to run the song backwards. However, this
- is nearly impossible, so currently it restarts the song. In theory, the
- program should continue to rewind until notified otherwise, so be
- prepared to receive the normal play command (described next).
-
- '|' Return to Normal Play (i.e. Cancel Fast Forward or Rewind)
- This is sent when the user releases the mouse button from the rewind or
- fast forward control. If you are fast forwarding, resume normal tempo.
- If you are not fast forwarding (then you probably got a rewind command)
- just ignore it, but be prepared for it.
-
- '+' Increase Loudness
- Increase the volume a bit. This isn't too important.
-
- '-' Decrease Loudness
- Likewise.
-
-
-
- Returning Error Messages to the Launcher:
-
- If the Server runs out of memory, encounters a really bad error, can't
- play the song, or something else happens, this event should be sent back
- to the Interface so that an alert can be presented to the user.
-
- Note that these error messages describe FATAL errors. Therefore, only one
- error should ever be sent per song and the tracker Server should exit
- immediately after sending the event.
-
- The Event Class is '∫Tsp' and the Event ID is '∫Err'. It contains one
- parameter of keyword '∫Er#' and type typeShortInteger. Pass the following
- values for whichever error applies.
-
- 0: An unknown error occured.
- 1: Server ran out of memory loading the song or setting up the buffers.
- 2: An internal error occurred (generic "catch-all" type of error).
- 3: Server can't open compressed files. This is in here because Marc Espies's
- Tracker will automatically pipe files through their appropriate decompressors
- if there is an extention like ".zip" or ".Z". Since the Macintosh doesn't
- support pipes, the function "popen" sends this error. Tell the user to
- rename the file so that it doesn't have the extention any more.
- As a side note: I've modified the way I call Espie's main(argc,argv)
- routine, so if "Tracker Server" ever sends this error, it is indicative
- of a serious malfunction of the program. I would suggest avoiding
- using this error message for anything in your own Servers.
- 4: The Server couldn't open the file. This can be sent whenever the file can't
- be open, for whatever reason that might be (file table full, too many
- open working directories, etc...)
- 5: Server Could't close file. This will probably never happen, but it's in here
- just in case.
- 6: Server was told to open a file that isn't a song. You should send this, but
- you'll notice I haven't hacked Espie's calls to perror() and printf() to check
- for his message "Not a song", so obviously it's not a high priority on
- my list!
- 7: 68020 processor required.
-
-
-
- What to do when the song is finished:
-
- Just exit! The Finder will automatically send the Interface an 'OBIT' event
- (Application Died) which the Interface should then interpret to mean it can
- start the next song or do whatever operation is called for.
-
-
-
- Quit Events:
-
- When the user cancels a song or shuts down the computer, a standard Quit Event
- is sent to the tracker program. It should stop sound production, immediately
- dispose of any precomputed buffers, close sound channels, and exit. This should
- all be done as soon as possible to prevent sluggishness.
-
-